POV-Ray : Newsgroups : povray.binaries.images : Flower : Re: Flower Server Time
1 Oct 2024 20:24:19 EDT (-0400)
  Re: Flower  
From: Mike
Date: 18 Aug 2000 05:14:30
Message: <399CFE73.B484F167@aol.com>
> Yes but you can have different uv mapping : planar, cylindrical,
> spherical. Can I know more about it. Which procedure to follow
> to get this texture?

Well, by uv mapping I meant that the texture is mapped to the 2D space
of the surface, which in the case of a bicubic patch is typically a unit
square.

The texture as much as it shows with the bad jpeg compression could
pretty easily be achieved with a gradient y pigment.  But to get
specific about what I did here, I wrote a patch for MegaPOV that does uv
mapping for type 2 bicubic patches.  Then I changed the uv mapping code
to calculate a 3x3 homogenous mapping matrix using the 4 corners of a
quadrilateral (the uv vectors) assuming the patch space is a unit square
and having the homogenous coordinate set to 1.  This matrix is used each
time a ray intersects the surface of the patch by tranforming the u and
v location of the patch at the current intersection to texture space (or
maybe the other way around).

Then I updated the pov-ray exporter for Animation Master available at
http://free.prohosting.com/~olana/plugins/plugins.html to write the
texture coordinates in pov format using the new syntax.  To keep things
fast, I write a seperate include file with the textures needed for the
model, otherwise each image would be parsed for each patch and it would
take forever.  The new plugin hasn't been released yet though.  The
problem is that I think I'm near the limit of my ftp space and can't
upload everything there.

It's plausible that this could be done by hand but I wouldn't want to.
Some macros could probably be made to create the uv vectors, or in the
case of sPatch models you could use a find and replace to add uv vectors
that are a unit square, thus allowing for the mapping of a tilable
image.

I uploaded a copy of the windows binary with the new uv mapping and
included a short text file explaining how the uv_vectors relate to the
texture and the patch.  It's in povray.binaries.programming.  You should
be able to render the scene files I uploaded to binaries.scene-files
with it.

As an example, here's what one patch looks like:

bicubic_patch {
type 2
accuracy 0.1
uv_vectors <0.5475359559059143, 0.9598205089569092>,
<0.5189526081085205, 0.960773766040802>, <0.615035891532898,
0.7563253045082092>, <0.7078137397766113, 0.7766876816749573>
<1.239059209823608, -0.01280438248068094, 1.6783527135849>,
<1.065836906433106, 0.1083308532834053, 1.747843623161316>,
<0.8545190691947937, 0.1975981742143631, 1.807306289672852>,
<0.645129919052124, 0.2410857826471329, 1.846774458885193>,
<2.281259059906006, 0.2899681329727173, 2.865853786468506>,
<2.073765516281128, 0.5121513605117798, 2.92615818977356>,
<1.813590884208679, 0.7627856731414795, 2.980928659439087>,
<1.548043966293335, 0.8501358032226563, 3.049945831298828>,
<3.277821063995361, 0.9094398617744446, 4.084438323974609>,
<3.087475061416626, 1.274701952934265, 4.069855690002441>,
<2.652498245239258, 1.616940975189209, 4.161567687988281>,
<2.316552639007568, 1.618627786636353, 4.310638427734375>,
<4.087599754333496, 1.740859031677246, 5.157229423522949>,
<3.848036289215088, 2.162004947662354, 5.15593147277832>,
<3.304417133331299, 2.48495364189148, 5.332837104797363>,
<2.897367477416992, 2.485338926315308, 5.533927917480469>
uv_mapping double_illuminate
texture { Base0 }
normal { Decal0 }
interior { Interior0 }
}

(now that I look at that, I could probably save space by lowering the
precision)

and here's the textures I used.

#declare Base0 =
 texture {
  pigment {
     image_map {
     tga "petalcolor.tga"
     once
     interpolate 4
     }
   scale <1, -1, 1>
   translate 1*y
   }
     finish {
     ambient 0
     phong .9
     phong_size 40
     brilliance .5
     diffuse .9
     reflection 0
     metallic
    }
  }

#declare Interior0 =   interior { ior 1 }

#declare Decal0 =
   normal {
     bump_map {
     tga "petalbump.tga"
     once
     interpolate 4
     }
     bump_size 2
   scale <1, -1, 1>
   translate 1*y
   }

Probably way more than you wanted to know.  Sadly, this is something
I've spent way too much time on and yet have a hard time explaining it
to anyway.  None of the hash users want to be bothered with POV-Ray
(they all want me to work on the RIB exporter tho none of them know jack
about RIB. grrr).  Then when I mention Hash here it's like everyone
thinks I've been smoking the stuff...still, I've been having a blast
with all these low-tech tools I've cooked up. :-)


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.